#include "dataset.h"


Dataset::Dataset(cv::String format)
{
	capture = new cv::VideoCapture(format);
}

cv::Mat Dataset::grab()
{
	cv::Mat gray;
	capture->read(gray);

	return gray;
}


std::string Path::combine(const std::string & item1, const std::string & item2)
{
	if (item1.empty()) return item2;
	if (item2.empty()) return item1;

	char last = item1[item1.size() - 1];

	bool need_append = last != '/' && last != '\\';
	return item1 + (need_append ? "/" : "") + item2;
}

std::string Path::combine_format(std::string item1, std::string item2, ...)
{
	std::string fmt = Path::combine(item1, item2);
	char buffer[1 << 16];
	va_list args;
	va_start(args, item2);
	vsprintf(buffer, fmt.c_str(), args);
	va_end(args);
	return std::string(buffer);
}